import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sciolto/api/Common_api.dart';
import 'package:sciolto/util/setting.dart';
import 'package:sciolto/widget/custom_widget.dart';
import 'package:sciolto/widget/revolvingWidget.dart';
/*
问题：1.软键盘升起时候限制了输入大小
      滚动要怎么加合适
      2.输入完成 确定的方式 button?

 */
class FeelingPage extends StatefulWidget{
  // final String songName;
  // FeelingPage(this.songName);
  @override
  State<StatefulWidget> createState() => _FeelingPageState();
}

class _FeelingPageState extends State<FeelingPage>{
  double _x, _y, _width, _height;
   TextEditingController _useController = new TextEditingController();
   FocusNode focusNode = new FocusNode();
   String preText = "";
  @override
  void initState() {

    super.initState();
    _useController = TextEditingController.fromValue(
      TextEditingValue(
        text: preText,
        selection: TextSelection.fromPosition(
          TextPosition(
              affinity: TextAffinity.downstream,
              offset: preText.length),
        ),
      ),
    );

    _useController.addListener((){
      String currentStr = _useController.text;
      print(" controller is  $currentStr");
    });
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    Size size = CommonApi.initParameter(context);
    _width = size.width;
    _height = size.height;
    _x = size.width / 420;
    _y = size.height / 800;
  }

  @override
  Widget build(BuildContext context) {
    _useController.addListener((){

    });
    return Scaffold(
        body: Container(
          width: _width,
          height: _height - 140 * _y,
          //  crossAxisAlignment: CrossAxisAlignment.center,
          color: Setting.themeColor,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              SizedBox(
                width: 100,
                height: 50,
                child: RevolvingText(
                  text: "金轮金轮，我的金轮嘿嘿嘿🤭",
                ),
              )
            ],
          ),
        )

    );
  }




  void onTapAddingButton(){
    print('onTap Concern');
  }


}
